namespace Columbus
{
    /// <summary>
    /// Extension methods for ActionResult
    /// </summary>
    public static class ActionResultExtensions
    {
        /// <summary>
        /// Indicates that navigator needs to save request (that invoked this action) in journal.
        /// </summary>
        /// <typeparam name="T">Result type</typeparam>
        /// <param name="result">Action result.</param>
        /// <returns>Action result</returns>
        public static T NeedToSaveRequestInJournal<T>(this T result) where T : ActionResult
        {
            result.NeedToSaveRequestInJournal = true;
            return result;
        }

        /// <summary>
        /// Indicates that navigator does not need to save request (that invoked this action) in journal.
        /// </summary>
        /// <typeparam name="T">Result type</typeparam>
        /// <param name="result">Action result.</param>
        /// <returns>Action result</returns>
        public static T NoNeedToSaveRequestInJournal<T>(this T result) where T : ActionResult
        {
            result.NeedToSaveRequestInJournal = false;
            return result;
        }
    }
}